package kr.hkit.myframework.uicomp;

import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import java.awt.GridLayout;
import javax.swing.SwingConstants;

public class InputCombo extends JPanel {

	private JLabel lblCombo;
	private JComboBox<Object> combo_deptNo;
	
	/**
	 * Create the panel.
	 */
	public InputCombo(String lblStr) {

		initialize();
		lblCombo.setText(lblStr);
	}
	private void initialize() {
		setLayout(new GridLayout(0, 2, 0, 0));
		
		lblCombo = new JLabel("New label");
		lblCombo.setHorizontalAlignment(SwingConstants.CENTER);
		add(lblCombo);
		
		combo_deptNo = new JComboBox<>();
		add(combo_deptNo);
		
	}
	
	public String getSelectItem(){ //현재 선택한 값 반환용. get
		return (String) combo_deptNo.getSelectedItem();
	}
	
	public int getSelectIndex() {
		return combo_deptNo.getSelectedIndex();
		
	}
	
	public void setDefaultSelectIndex(int idx){ //set 인덱스
		combo_deptNo.setSelectedIndex(idx);
	}
	
	public void setSelectItem(String str){ //set   
		combo_deptNo.setSelectedItem(str);
		
	}
	
	
	public void setEnableF(){
		combo_deptNo.setEnabled(false);
	}
	
	public void setEnableT(){
		combo_deptNo.setEnabled(true);
	}
	
	public void addItems(String...lists) {
		for (String items : lists){
			combo_deptNo.addItem(items);
		}
	}
	
	/*public void addItems(Integer...lists) {
		for (Integer items : lists){
			combo_deptNo.addItem(items);
		}
	}*/
	
}
